Unit PrintGraf;

interface
uses
graph,printer,globvar;

procedure PrintGraph(mode,direction  :  integer);

Implementation

Procedure PrintGraph(Mode, Direction : integer);

const   ESC=#$1B;

var ll,ii,jj,kk,mm,mmsb,llsb,MMaxX,MMaxY  : Integer;

begin
    MMaxX:=639;
    MMaxY:=442;
    write(lst,#$0C);


 (*   writeLn(lst,'                                                               ');
    wRITElN(LST);
    WriteLn(lst,'                                                      ');
    WriteLn(lst,'                                               ');
    WriteLn(lst,'                                                 ');*)







  WriteLn(lst,'        Dr. Carlos Roberto DeFaria - Dra. Susanie Caldas');
  WriteLn(lst,'                       Neurofisiologia Clinica');
  WriteLn(lst,'                           C E M E D I');
  WriteLn(lst,'          Rua 2 No. 657 Setor Oeste 74110-130 Goiania GO');
  WriteLn(lst,'                   TEL (062) 225 2326/229 2462');





  WriteLn;
  WriteLn(lst,'                                                                ');
    For ii:=1 to 10 do writeLN(lst);
     SetViewPort(0,15,MMaxX,MMaxY,false);
     {write(lst,esc,'A',char(8));}
      write(lst,esc,'A',#$07); {epson}
        case direction of
         1 : begin
           LLsb:=MMaxX and $00FF;
           MMsb:=MMaxX shr 8;
           for jj:=0 to MMaxY div 8 do

     begin
                write(lst,'            ');
                write(lst,esc,'*',char(mode),char(llsb),char(MMsb));
                for ii:=0 to MMaxX do
                begin
                  mm:=0;
                  for kk:=0 to 7 do begin
                  mm:=mm shl 1;
                   ll:=getpixel(ii,jj*8+kk);
                   case ll of
                    1..8 : inc(mm);
                    14..15: inc(mm);
                   end;
                  end;



(*           begin
                write(lst,'            ');
                write(lst,esc,'*',char(mode),char(llsb),char(MMsb));
                for ii:=0 to MMaxX do
                begin
                  mm:=0;
                  for kk:=0 to 7 do begin
                  mm:=mm shl 1;
                   If (getPixel(ii,jj*8+kk)=15)
                   or (getPixel(ii,jj*8+kk)=7)
                   or (getPixel(ii,jj*8+kk)=6)
                   or (getPixel(ii,jj*8+kk)=8)
                  then inc(mm);
                  end;*)





            write(lst,char(mm));
           end;
           write(lst,#$0D,#$0A);
           end;
        end;

     2:begin
      LLsb:=MMaxY and $00FF;
      MMsb:=MMaxY shr 8;
      jj:=0;
      repeat
        write(lst,esc,'*',char(mode),char(llsb),char(mmsb));
        for ii:=MMaxY downTo 0 do
        begin
          mm:=0;
          for kk:=0 to 7 do begin
            mm:=mm shl 1;
            If (getPixel(jj+kk,ii)=15)
            or (getPixel(jj+kk,ii)=7)
            or (getPixel(jj+kk,ii)=8)
            or (getPixel(jj+kk,ii)=6)
            then inc (mm);
            end;
            write(lst,char(mm));
          end;
          write(lst,#$0D,#$0A);
          inc(jj,8);
          until jj>=MMaxX-1;
      end;
end;
write(lst,#$0C);
{write(lst,#12,#0);}
SetViewPort(InitX,InitY,FinX,FinY,clipOn);
end;
end.